﻿using System;
using System.Windows.Data;

namespace ProbabilityNot
{
    public class FloatingPointTextConversion : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            double d = (double)value;
            return d.ToString((string)parameter);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            string fp = value as string;
            return System.Convert.ToDouble(fp);
        }
    }
}
